× Lesson 1 Lesson 2 Lesson 3 Lesson 4 Lesson 5 Lesson 6 Lesson 7 Lesson 8 Lesson 9 Lesson 10 Lesson 11 Lesson 12 Lesson 13 Lesson 14 Lesson 15 Lesson 16

All lessons

Lesson 8 - String operators

String operators are made up of a few functions, and the topic of functions will be covered much deeper later in the course, such as .format(), that can be used with or be used to modify a string. The first operator is the .upper() function, which when used at the end of a string will capitalize every single letter. The second operator is the .lower() function, which when placed at the end of a string will make every letter lower case. The third operator is the len() function, when when a string is placed in between the parenthesises the amount of letters in the string. len() can also be with a list to count the number of pieces of data in the list.

An example for each respectively:

print('Hello'.upper())

Which would output 'HELLO'.

print('Hello'.lower())

Which would output 'hello'.

print(len('hello'))

Which would output 5.

print(len([1, 2, 3]))

Which would output 3.

I challenge you to perform the following: Set your first name equal to a variable and your last name equal to a variable, find the length of both, and divide your first name length by your last name's length.